package org.the.gsdo.server;

import java.util.logging.Logger;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

//spring must scan this class (see ApplicationConfiguration :: basePackageClasses
@Component
// aspectj
@Aspect
@Profile("test")
public class LogAspectTest extends LogAspect {

	private static Logger log = Logger.getLogger(LogAspectTest.class.getName());

	@Around("anyPublicMethod() && @annotation(logAction)")
	public Object logAction(ProceedingJoinPoint pjp, LogAction logAction)
			throws Throwable {
		String actionPerformed = logAction.value();
		log.info("---- entry [" + actionPerformed + "]");
		return pjp.proceed();
	}

}
